package com.zrrd.io.byteStream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;

/**
 * @author WanJl
 * @version 1.0
 * @title FileInputStreamDemo02
 * @description
 * @create 2023/9/23 19:57
 */
public class FileInputStreamDemo02 {
    public static void main(String[] args) throws Exception {
        FileInputStream fileInputStream = new FileInputStream("D:/wanjl.txt");
        byte[] bytes=new byte[1024];//1024个byte的数组
        //循环读取，字节数组的方式
        int length;
        while ((length=fileInputStream.read(bytes))!=-1){
            System.out.println(new String(bytes,0,length));
        }

        fileInputStream.close();
    }
}
